import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class MyContainer {
  static Widget simpleContainer(){
    return Container(
      child: Text("普通Container"),
    );
  }

  static Widget colorContainer(){
    return Container(
      color: Colors.yellow,
      child: Text("带颜色的Container"),
    );
  }

  static Widget paddingContainer(){
    return Container(
      color: Colors.yellow,
      padding: EdgeInsets.all(15),
      child: Text("带内边距的Container"),
    );
  }

  static Widget marginContainer(){
    return Container(
      color: Colors.yellow,
      margin: EdgeInsets.all(15),
      child: Text("带外边距的Container"),
    );
  }

  static Widget widthAndHeightContainer(){
    return Container(
      color: Colors.yellow,
      width: 60,
      height: 90,
      child: Text("带宽高的Container"),
    );
  }

  static Widget decorationContainer1(){
    return Container(
      padding: EdgeInsets.symmetric(horizontal: 10),
      margin: EdgeInsets.all(20),
      decoration: BoxDecoration(
        shape: BoxShape.rectangle,
        borderRadius: BorderRadius.all(Radius.circular(20)),
        color: Colors.green
      ),
      child: Text("带decoration装饰的Container"),
    );
  }

  static Widget decorationContainer2(){
    return Container(
      padding: EdgeInsets.symmetric(horizontal: 10),
      margin: EdgeInsets.all(20),
      decoration: BoxDecoration(
          borderRadius: BorderRadius.all(Radius.circular(20)),
          border: Border.all(
            color: Colors.black,
            width: 2
          )
      ),
      child: Text("带decoration装饰的Container"),
    );
  }

  static Widget decorationContainer3(){
    return Container(
      width: 100,
      height: 100,
      margin: EdgeInsets.all(20),
      decoration: BoxDecoration(
        borderRadius: BorderRadius.all(Radius.circular(50)),
        image: DecorationImage(
          image: NetworkImage('https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fpic25.nipic.com%2F20121107%2F8847866_164210379199_2.jpg&refer=http%3A%2F%2Fpic25.nipic.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1612964990&t=75dab6f13588c3731a85ab1e32e1dec3'),
          fit: BoxFit.cover
        )
      ),
    );
  }

  static Widget transformContainer(){
    return Container(
      color: Colors.yellow,
      child: Text("转换Container示例"),
      alignment: Alignment.center,
      height: 60,
      width: 200,
      transform: Matrix4.rotationZ(0.8),
    );
  }
}
